package com.chinafree.common.utils;

import javax.annotation.PostConstruct;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;

@Component
public class ApplicationInit implements ApplicationContextAware {
 
 
    private ApplicationContext cxt;



 
@PostConstruct
public void init() {


    if (ApplicationContextUtils.getCxt() == null)
        ApplicationContextUtils.setCxt(this.cxt);

}

    @Override
    public void setApplicationContext(ApplicationContext applicationContext)
            throws BeansException {
        this.cxt = applicationContext;
        if (ApplicationContextUtils.getCxt() == null)
        ApplicationContextUtils.setCxt(this.cxt);
    }

}